package com.bupt.config;

import lombok.ToString;



@ToString
public enum CommonCode implements ResultCode{

    SUCCESS(true,10000,"操作成功！"),
    FAIL(false,11111,"操作失败！此名称已存在"),
    FAILNAME(false,11113,"操作失败！名称不能为空"),
    FAILS(false,11112,"操作失败！功能点格式不正确"),
    FAILSEX(false,11113,"操作失败！性别输入错误"),
    FAILs(false,11111,"操作失败！"),
    NOTDEVICEFAIL(false,11111,"操作失败！没有此设备"),
    NOTEXISTFAIL(false,22222,"操作失败！没有此通道"),
    EXISTFAIL(false,22222,"操作失败！此米数已被录入"),
    BEYONGDFAIL(false,22223,"操作失败！超过了此通道的最长米数"),
    PARAMFAIL(false,22223,"操作失败！起始不能小于结束米数"),
    UNAUTHENTICATED(false,10001,"此操作需要登陆系统！"),
    UNAUTHORISE(false,10002,"权限不足，无权操作！"),
    SERVER_ERROR(false,99999,"抱歉，系统繁忙，请稍后重试！");
//    private static ImmutableMap<Integer, CommonCode> codes ;
    //操作是否成功
    boolean success;
    //操作代码
    int code;
    //提示信息
    String message;
    private CommonCode(boolean success,int code, String message){
        this.success = success;
        this.code = code;
        this.message = message;
    }

    @Override
    public boolean success() {
        return success;
    }
    @Override
    public int code() {
        return code;
    }

    @Override
    public String message() {
        return message;
    }


}
